/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.contract.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 仓位表
 *
 * @since 2022-08-11 10:08:43
 */
@Data
@TableName("ripple_contract_position")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "仓位表")
public class ContractPosition extends Model<ContractPosition> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    private Long userId;

    /**
     * 币对id
     */
    @ApiModelProperty(value = "币对id")
    private Long symbolId;

    /**
     * 币对名称
     */
    @ApiModelProperty(value = "币对名称")
    private String symbolName;

    /**
     * 仓位模式（0逐仓、1全仓）
     */
    @ApiModelProperty(value = "仓位模式（0逐仓、1全仓）")
    private String mode;

    /**
     * 方向（0做多、1做空）
     */
    @ApiModelProperty(value = "方向（0做多、1做空）")
    private String side;

    /**
     * 倍数
     */
    @ApiModelProperty(value = "倍数")
    private Integer multiple;

    /**
     * 是否机器人（0否、1是）
     */
    @ApiModelProperty(value = "是否机器人（0否、1是）")
    private String isRobot;

    /**
     * 已开仓量
     */
    @ApiModelProperty(value = "已开仓量")
    private BigDecimal openNum;

    /**
     * 已平仓量
     */
    @ApiModelProperty(value = "已平仓量")
    private BigDecimal closeNum;

    /**
     * 当前持仓量
     */
    @ApiModelProperty(value = "当前持仓量")
    private BigDecimal nowNum;

    /**
     * 最大持仓量
     */
    @ApiModelProperty(value = "最大持仓量")
    private BigDecimal maxNum;

    /**
     * 可用数量
     */
    @ApiModelProperty(value = "可用数量")
    private BigDecimal availableNum;

    /**
     * 平仓中数量
     */
    @ApiModelProperty(value = "平仓中数量")
    private BigDecimal closingNum;

    /**
     * 开仓均价
     */
    @ApiModelProperty(value = "开仓均价")
    private BigDecimal openAvgPrice;

    /**
     * 平仓均价
     */
    @ApiModelProperty(value = "平仓均价")
    private BigDecimal closeAvgPrice;

    /**
     * 保证金
     */
    @ApiModelProperty(value = "保证金")
    private BigDecimal margin;

    /**
     * 平仓收益，平仓后有值
     */
    @ApiModelProperty(value = "平仓收益，平仓后有值")
    private BigDecimal profit;

    /**
     * 平仓收益率，平仓后有值
     */
    @ApiModelProperty(value = "平仓收益率，平仓后有值")
    private BigDecimal profitRate;

    /**
     * 强平价
     */
    @ApiModelProperty(value = "强平价")
    private BigDecimal liquidatePrice;

    /**
     * 是否需要强平（0否、1是）
     */
    @ApiModelProperty(value = "是否需要强平（0否、1是）")
    private String needLiquidate;

    /**
     * 手续费
     */
    @ApiModelProperty(value = "手续费")
    private BigDecimal handlingFee;

    /**
     * 强平清算费
     */
    @ApiModelProperty(value = "强平清算费")
    private BigDecimal liquidateFee;

    /**
     * 开仓时间
     */
    @ApiModelProperty(value = "开仓时间")
    private LocalDateTime openTime;

    /**
     * 平仓时间
     */
    @ApiModelProperty(value = "平仓时间")
    private LocalDateTime closeTime;

    /**
     * 保证金率
     */
    @ApiModelProperty(value = "保证金率")
    private BigDecimal marginRate;

    /**
     * 保证金率检查状态（0正常、1已发送邮件）
     */
    @ApiModelProperty(value = "保证金率检查状态（0正常、1已发送邮件）")
    private String marginCheckStatus;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    private Long createBy;

    /**
     * 修改时间
     */
    @ApiModelProperty(value = "修改时间")
    private LocalDateTime updateTime;

    /**
     * 修改人
     */
    @ApiModelProperty(value = "修改人")
    private Long updateBy;

    /**
     * 仓位状态（0持仓中、1部分平仓、2全部平仓、3已强平）
     */
    @ApiModelProperty(value = "仓位状态（0持仓中、1部分平仓、2全部平仓、3已强平）")
    private String status;

    /**
     * 是否删除（null是、0否）
     */
    @ApiModelProperty(value = "是否删除（null是、0否）")
    private String isDeleted;

    /**
     * 持仓人数
     */
    @TableField(exist = false)
    private Integer count;
}
